a tool for shared writing and social publishing
at debug/datetime 64 lines 2.3 kB view raw
1"use client"; 2import { useUIState } from "src/useUIState"; 3import { Footer as ActionFooter } from "components/ActionBar/Footer"; 4import { Media } from "components/Media"; 5import { ThemePopover } from "components/ThemeManager/ThemeSetter"; 6import { Toolbar } from "components/Toolbar"; 7import { ShareOptions } from "components/ShareOptions"; 8import { HomeButton } from "components/HomeButton"; 9import { useEntitySetContext } from "components/EntitySetProvider"; 10import { HelpPopover } from "components/HelpPopover"; 11import { Watermark } from "components/Watermark"; 12import { BackToPubButton, PublishButton } from "./Actions"; 13import { useLeafletPublicationData } from "components/PageSWRDataProvider"; 14import { useIdentityData } from "components/IdentityProvider"; 15 16export function LeafletFooter(props: { entityID: string }) { 17 let focusedBlock = useUIState((s) => s.focusedEntity); 18 let entity_set = useEntitySetContext(); 19 let { identity } = useIdentityData(); 20 let { data: pub } = useLeafletPublicationData(); 21 22 return ( 23 <Media mobile className="mobileFooter w-full z-10 touch-none -mt-[54px] "> 24 {focusedBlock && 25 focusedBlock.entityType == "block" && 26 entity_set.permissions.write ? ( 27 <div 28 className="w-full z-10 p-2 flex bg-bg-page pwa-padding-bottom" 29 onMouseDown={(e) => { 30 if (e.currentTarget === e.target) e.preventDefault(); 31 }} 32 > 33 <Toolbar 34 pageID={focusedBlock.parent} 35 blockID={focusedBlock.entityID} 36 /> 37 </div> 38 ) : entity_set.permissions.write ? ( 39 pub?.publications && 40 identity?.atp_did && 41 pub.publications.identity_did === identity.atp_did ? ( 42 <ActionFooter> 43 <BackToPubButton publication={pub.publications} /> 44 <PublishButton /> 45 <ShareOptions /> 46 <HelpPopover /> 47 <ThemePopover entityID={props.entityID} /> 48 </ActionFooter> 49 ) : ( 50 <ActionFooter> 51 <HomeButton /> 52 <ShareOptions /> 53 <HelpPopover /> 54 <ThemePopover entityID={props.entityID} /> 55 </ActionFooter> 56 ) 57 ) : ( 58 <div className="pb-2 px-2 z-10 flex justify-end"> 59 <Watermark mobile /> 60 </div> 61 )} 62 </Media> 63 ); 64}